{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "cdcd865c-1264-413f-b317-452953ebb5f8",
   "metadata": {},
   "source": [
    "### Try this notebook in Google Colab, Binder or SageMaker!\n",
    "\n",
    "[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/InsightSoftwareConsortium/itkwidgets/blob/main/examples/NumPyArrayPointSet.ipynb)\n",
    "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/InsightSoftwareConsortium/itkwidgets/HEAD?labpath=examples%2FNumPyArrayPointSet.ipynb)\n",
    "[![Open In SageMaker Studio Lab](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github.com/InsightSoftwareConsortium/itkwidgets/blob/main/examples/NumPyArrayPointSet.ipynb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "492c7f7a-b291-4f01-9c85-9fea9da52fcc",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "\n",
    "!{sys.executable} -m pip install -q \"itkwidgets[all]>=1.0a23\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ee6c9cad-31f9-4adc-8740-6bb2103ade97",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from itkwidgets import view"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "684615f0-f389-460f-8de6-6e3fc986d022",
   "metadata": {},
   "outputs": [],
   "source": [
    "number_of_points = 3000\n",
    "gaussian_mean = [0.0, 0.0, 0.0]\n",
    "gaussian_cov = [[1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 0.5]]\n",
    "point_set = np.random.multivariate_normal(gaussian_mean, gaussian_cov, number_of_points)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "77eddd48-d365-43f0-8025-4ace104ca387",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "                <img id=\"screenshot_imjoy_window_722de9c4-5217-4e47-90da-d1ac58fde054\" src=>\n",
       "                <script type=\"text/javascript\">\n",
       "                    var image = document.getElementById(\"screenshot_imjoy_window_722de9c4-5217-4e47-90da-d1ac58fde054\");\n",
       "                    image.src = \"\";\n",
       "                    var viewer = document.getElementById(\"imjoy_window_722de9c4-5217-4e47-90da-d1ac58fde054\");\n",
       "                    // Hide the static image if the Viewer is visible\n",
       "                    image.style.display = viewer ? \"none\" : \"block\";\n",
       "                </script>\n",
       "            "
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "window.connectPlugin && window.connectPlugin(\"0ff730ea-49ff-498f-a1c1-997de5758e50\")"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div id=\"af0d4bb2-ff08-4f29-83c8-a2f6d109790f\"></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "viewer = view(point_set)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "83dfad1a-7199-4647-81da-57ce7cb1088e",
   "metadata": {},
   "outputs": [],
   "source": [
    "number_of_points_2 = 3000\n",
    "gaussian_mean_2 = [0.5, 1.0, 0.0]\n",
    "gaussian_cov_2 = [[1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 0.5]]\n",
    "point_set_2 = np.random.multivariate_normal(gaussian_mean, gaussian_cov, number_of_points)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "5eac65f8-e50f-4ba6-bd27-4386739ca805",
   "metadata": {},
   "outputs": [],
   "source": [
    "viewer.add_point_set(point_set_2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6a6cb39a-de85-4dce-b4c4-f9a0f9d6712e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
